<?php

class Post_Form_Note extends Zend_Form
{
	public function init()
	{
		parent::init();

        // Set the method for the display form to POST
		$this
			->setAction('')
			->setMethod('post')
		;

		$stripSlashesFilter = new Euso_Filter_StripSlashes();

		$elem = new Zend_Form_Element_Text('post_title');
		$elem
			->setLabel('Title:')
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->setAttrib('size', 64)
			->setAttrib('tabindex', 0)
		;
		$this->addElement($elem);

		$elem = new Zend_Form_Element_TextArea('post_content');
		$elem
			->setLabel('Content:')
			->setRequired(true)
			->addFilter($stripSlashesFilter)
//			->addFilter('StringTrim')
			->setAttrib('rows', 24)
			->setAttrib('cols', 64)
			->setAttrib('escape', false)
		;
		$this->addElement($elem);

		$elem = new Zend_Form_Element_Submit('post_publish');
		$elem
			->setLabel('Publish')
			->setAttrib('class', 'submit')
			->removeDecorator('DtDdWrapper')
		;
		$this->addElement($elem);

		$elem = new Zend_Form_Element_Submit('post_save');
		$elem
			->setLabel('Save as Draft')
			->setAttrib('class', 'submit')
			->removeDecorator('DtDdWrapper')
		;
		$this->addElement($elem);

		$elem = new Zend_Form_Element_Hidden('post_submit_return');
		$this->addElement($elem);

		$this->addDisplayGroup(array('post_publish', 'post_save', 'post_submit_return'), 'post_submits');
		$dg = $this->getDisplayGroup('post_submits');
		$dg
			->clearDecorators()
			->addDecorator('FormElements')
			->addDecorator('DtDdWrapper')
		;
	}
}
